package 题目集.线段树or树状数组.树状数组;

import java.io.*;

/**
 * 区间修改，单点查询
 */
public class ch02_差分模板 {
    static int n, m;
    static long[] tree;
    static PrintWriter pr=new PrintWriter(new OutputStreamWriter(System.out));
    public static void main(String[] args) {
        Reader sc = new Reader();
        n = sc.nextInt();
        m = sc.nextInt();
        tree=new long[n+1];
        for (int i = 1; i <= n; i++) {
            add(i,i,sc.nextLong());
        }
        for (int i = 0; i < m; i++) {
            int op=sc.nextInt();
            if (op==1){
                int l=sc.nextInt();
                int r=sc.nextInt();
                long v=sc.nextLong();
                add(l,r,v);
            }else {
                pr.println(query(sc.nextInt()));
            }
        }
        pr.flush();
    }

    public static void add(int l, int r,long v) {
        add(l,v);
        add(r+1,-v);    //不需要担心r+1越界，因为越界不会被处理
    }

    public static void add(int i,long v) {
        while (i<=n){
            tree[i]+=v;
            i+=lowbit(i);
        }
    }
    public static long query(int i){
        long res=0;
        while (i>0){
            res+=tree[i];
            i-=lowbit(i);
        }
        return res;
    }

    public static int lowbit(int x) {
        return x & -x;
    }
    static class Reader{
        StreamTokenizer in=new StreamTokenizer(new InputStreamReader(System.in));

        public int nextInt(){
            try {
                in.nextToken();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return (int) in.nval;
        }
        public long nextLong(){
            try {
                in.nextToken();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return (long) in.nval;
        }
    }

}
